<?php $this->placeholder('container-class')->set('post_ad maid')?>
<?php $this->JQuery()->javascriptCaptureStart()?>

    $j('#add_more_btn').click(function() {
        if ($j('#add_more_checkbox').attr('value') == 1) {
            $j('#add_more_checkbox').attr('value',0);
        }
        else {
            $j('#add_more_checkbox').attr('value',1);
        }
        $j('#add_more').toggle();
        return false;
    });

    if ($j('#add_more_checkbox').attr('value') == 0) {
        $j('#add_more').show();
    }
    else {
        $j('#add_more').hide();
    }

    // Control for Title
    $j('input#title').keydown(function(event) {
        var charLength = 100 - $j(this).val().length;
        if (charLength <0) {
            if ( event.keyCode == 8 || event.keyCode == 46 ) {

            } else {
                return false;
            }
        }
        else {
            $j('span#counter_title').html('<em>'+charLength + '</em> <?php echo $this->t('characters remaining')?>');
        }
    });

    // Control for reason leaving previous job
    $('textarea#reasonleavingpreviousjob').keydown(function(event) {
        var charLength = 3000 - $(this).val().length;
        if (charLength <0) {
            if ( event.keyCode == 8 || event.keyCode == 46 ) {

            } else {
                return false;
            }
        }
        else {
            $('span#counter_description').html('<em>'+charLength + '</em> <?php echo $this->t('characters remaining')?>');
        }
    });

    // Control for description
    $('textarea#description').keydown(function(event) {
        var charLength = 3000 - $(this).val().length;
        if (charLength <0) {
            if ( event.keyCode == 8 || event.keyCode == 46 ) {

            } else {
                return false;
            }
        }
        else {
            $('span#counter_description2').html('<em>'+charLength + '</em> <?php echo $this->t('characters remaining')?>');
        }
    });

    $j('#preview_link').click(function() {
        var action = $j('#listing_form').attr('action');
        $j('#listing_form').attr('action', '<?php echo $this->preview_link?>');
        $j('#listing_form').attr('target','_blank');
        $j('#listing_form').submit();
        $j('#listing_form').attr('action', action);
        $j('#listing_form').attr('target','_self');
        return false;
    });

<?php $this->JQuery()->javascriptCaptureEnd()?>

<form action="<?php echo $this->escape($this->form->getAction()) ?>" method="<?php echo $this->escape($this->form->getMethod())?>" id="listing_form"  enctype="multipart/form-data">
<fieldset>
    <legend><?php echo $this->t('Create Your Ad');?></legend>
        <div class="required"><?php echo $this->t('Required Information')?></div>
        <div class="category desc">
              <label><?php echo $this->t('Selected Categories')?>
                  <?php /*if (!isset($_GET['id'])):?>
                    (<a href="<?php echo $this->geturl('post-an-ad', 'listing', null, null, array('category' => $_GET['category'], 'change' => 1))?>">Change</a>)
                  <?php endif;*/?>
                  :
              </label>
              <ul>
                  <?php foreach($this->category as $cat):?>
                      <li>
                          <?php
                            $tmp = array();
                            foreach($cat->getParentTree() as $p) {
                                $tmp[] = $p->name;
                            }
                            echo implode(' &gt; ', $tmp);
                          ?>
                      </li>
                  <?php endforeach;?>
             </ul>
        </div>
        <input type="hidden" name="adid" id="adid" value="<?php echo $this->adid?>">
        <?php foreach($this->category as $cat):?>
            <input type="hidden" name="category[]" value="<?php echo $cat->_id?>">
        <?php endforeach;?>

        <div class="title text">
              <label class="required"><?php echo $this->t('Title')?></label>
              <span id="counter_title"><?php echo $this->t('<em>100</em> characters remaining')?></span>
              <?php echo $this->form->title ?>
              <?php if (!empty($_POST['title'])) { ?>
              <?php if (preg_match("#.[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}.#", $_POST['title'])) { ?>
                  <ul class="errors"><li><?php echo $this->t('Please remove email')?></li></ul>
              <?php } } ?>
        </div>

        <div class="custom_info">
            <div class="custom_info_1">
                <div class="age select">
                    <label class="required"><?php echo $this->t('Age')?></label>
                    <?php echo $this->form->age ?>
                </div>
                <div class="education select">
                    <label class="required"><?php echo $this->t('Education')?></label>
                    <?php echo $this->form->education ?>
                </div>
                <div class="languages select">
                  <label class="required"><?php echo $this->t('Languages')?></label>
                    <?php echo $this->form->languages ?>
                </div>
                <div class="nationality select">
                    <label class="required"><?php echo $this->t('Nationality')?></label>
                    <?php echo $this->form->nationality ?>
                </div>
                <div class="religion select">
                    <label class="required"><?php echo $this->t('Religion')?></label>
                    <?php echo $this->form->religion ?>
                </div>
            </div>
            <div class="custom_info_2">
                <div class="maritalstatus select">
                    <label class="required"><?php echo $this->t('Marital Status')?></label>
                    <?php echo $this->form->maritalstatus ?>
                </div>
                <div class="gender select">
                    <label class="required"><?php echo $this->t('Gender')?></label>
                    <?php echo $this->form->gender ?>
                </div>
                <div class="availabletostart text">
                    <label class="required"><?php echo $this->t('Available to Start')?></label>
                    <?php echo $this->form->availabletostart ?>
                </div>
                <div class="employmenttype select">
                    <label class="required"><?php echo $this->t('Employment Type')?></label>
                    <?php echo $this->form->employmenttype ?>
                </div>
                <div class="visastatus select">
                    <label class="required"><?php echo $this->t('Visa Status')?></label>
                    <?php echo $this->form->visastatus ?>
                </div>
                <div class="reason textarea">
                    <label class="required"><?php echo $this->t('Reason for leaving previous job')?></label>
                    <span id="counter_description"><?php echo $this->t('<em>3000</em> characters remaining')?></span>
                    <?php echo $this->form->reasonleavingpreviousjob?>
                    <?php if (!empty($_POST['reasonleavingpreviousjob'])) { ?>
                    <?php if (preg_match("#.[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}.#", $_POST['reasonleavingpreviousjob'])) { ?>
                      <ul class="errors"><li><?php echo $this->t('Please remove email')?></li></ul>
                    <?php } } ?>
                    <span id="info_description"><?php echo $this->t('To prevent spam, do not enter any email addresses.')?></span>
                </div>
            </div>
        </div>

        <div class="more">
            <h1 class="required"><?php echo $this->t('Overall Skillsets')?></h1>
            <div class="select text">
                <dl><dt><label class="required"><?php echo $this->t('Cooking Style')?> </label><?php echo $this->t('Western')?></dt>
                <dd class="item001"><label class="required"><?php echo $this->t('Skill Level')?></label><?php echo $this->form->skilllevelwestern ?></dd>
                <dd class="item002"><label class="required"><?php echo $this->t('Specialiities')?></label><?php echo $this->form->specialitieswestern ?></dd>
                <dt><label class="required"><?php echo $this->t('Cooking Style')?> </label><?php echo $this->t('Chinese')?></dt>
                <dd class="item001"><label class="required"><?php echo $this->t('Skill Level')?></label><?php echo $this->form->skilllevelchinese ?></dd>
                <dd class="item002"><label class="required"><?php echo $this->t('Specialiities')?></label><?php echo $this->form->specialitieschinese ?></dd>
                <dt><label class="required"><?php echo $this->t('Cooking Style')?> </label><?php echo $this->t('Others')?></dt>
                <dd class="item001"><label class="required"><?php echo $this->t('Skill Level')?></label><?php echo $this->form->skilllevelother ?></dd>
                <dd class="item002"><label class="required"><?php echo $this->t('Specialiities')?></label><?php echo $this->form->specialitiesother ?></dd>
                </dl>
                </div>
                <div class="select">
                <dl>
                <dt><label class="required"><?php echo $this->t('People Care and Nursing')?> </label><?php echo $this->t('Newborn Experience')?></dt>
                <dd class="item001"><label class="required"><?php echo $this->t('Years of Experience')?></label><?php echo $this->form->yearexpnewborn ?></dd>
                <dt><label class="required"><?php echo $this->t('People Care and Nursing')?> </label><?php echo $this->t('Children Experience')?></dt>
                <dd class="item001"><label class="required"><?php echo $this->t('Years of Experience')?></label><?php echo $this->form->yearexpchildren ?></dd>
                <dt><label class="required"><?php echo $this->t('People Care and Nursing')?> </label><?php echo $this->t('Disable Experience')?></dt>
                <dd class="item001"><label class="required"><?php echo $this->t('Years of Experience')?></label><?php echo $this->form->yearexpdisable ?></dd>
                <dt><label class="required"><?php echo $this->t('People Care and Nursing')?> </label><?php echo $this->t('Elderly Experience')?></dt>
                <dd class="item001"><label class="required"><?php echo $this->t('Years of Experience')?></label><?php echo $this->form->yearexpelderly ?></dd>
                </dl>
                </div>
                <div class="checkbox">
                  <span class="required"><?php echo $this->t('Household and Cleaning')?></span>
                  <?php echo $this->form->householdcleaning ?>
                </div>
                <h1 class="required">Overseas Experience</h1>
                <div class="select">
                <dl>
                <dt><label class="required">Location</label>Hong Kong</dt>
                <dd class="item001"><label class="required"><?php echo $this->t('Years of Experience')?></label><?php echo $this->form->yearexphk ?></dd>
                <dt><label class="required">Location</label>Indonesia</dt>
                <dd class="item001"><label class="required"><?php echo $this->t('Years of Experience')?></label><?php echo $this->form->yearexpind ?></dd>
                <dt><label class="required">Location</label>Malaysia</dt>
                <dd class="item001"><label class="required"><?php echo $this->t('Years of Experience')?></label><?php echo $this->form->yearexpmal ?></dd>
                <dt><label class="required">Location</label>Middle East</dt>
                <dd class="item001"><label class="required"><?php echo $this->t('Years of Experience')?></label><?php echo $this->form->yearexpmid ?></dd>
                <dt><label class="required">Location</label>Philippines</dt>
                <dd class="item001"><label class="required"><?php echo $this->t('Years of Experience')?></label><?php echo $this->form->yearexpphil ?></dd>
                <dt><label class="required">Location</label>Singapore</dt>
                <dd class="item001"><label class="required"><?php echo $this->t('Years of Experience')?></label><?php echo $this->form->yearexpsing ?></dd>
                <dt><label class="required">Location</label>Taiwan</dt>
                <dd class="item001"><label class="required"><?php echo $this->t('Years of Experience')?></label><?php echo $this->form->yearexptai ?></dd>
                <dt><label class="required">Location</label>Thailand</dt>
                <dd class="item001"><label class="required"><?php echo $this->t('Years of Experience')?></label><?php echo $this->form->yearexpthai ?></dd>
                <dt><label class="required">Location</label>Other</dt>
                <dd class="item001"><label class="required"><?php echo $this->t('Years of Experience')?></label><?php echo $this->form->yearexpoth ?></dd>
                </dl>
            </div>
        </div>
      
        <div class="property_info_more button desc">
            <?php echo $this->form->add_more_checkbox?>
            <button id="add_more_btn"><?php echo $this->t('Add More')?></button>
            <p><?php echo $this->t('Click to "Add More" specifications to your Car Info')?></p>
        </div>

        <div class="property_info_more optional" id="add_more" style="display: none;">
            <div class="weight text">
                <label><?php echo $this->t('Weight')?></label>
                <?php echo $this->form->weight;?>
            </div>
            <div class="height text">
                <label><?php echo $this->t('Height')?></label>
                <?php echo $this->form->height;?>
            </div>
            <div class="chineseZodiac select">
                <label><?php echo $this->t('Chinese Zodiac')?></label>
                <?php echo $this->form->chinesezodiac;?>
            </div>
            <div class="horoscope select">
                <label><?php echo $this->t('Horoscope')?></label>
                <?php echo $this->form->horoscope;?>
            </div>
            <div class="preferredJobLocation select">
                <label><?php echo $this->t('Preferred Job Location')?></label>
                <?php echo $this->form->joblocation;?>
            </div>

            <div class="description textarea">
                <label><?php echo $this->t('Descriptions - Life Philosophy, Hobbies, Self Intro, References')?></label>
                <span id="counter_description2"><em>1000</em> <?php echo $this->t('characters remaining')?></span>
                <?php echo $this->form->description;?>
                <?php if (!empty($_POST['description'])) { ?>
                <?php if (preg_match("#.[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}.#", $_POST['reasonleavingpreviousjob'])) { ?>
                  <ul class="errors"><li><?php echo $this->t('Please remove email')?></li></ul>
                <?php } } ?>
                <span id="info_description"><?php echo $this->t('To prevent spam, do not enter any email addresses.')?></span>
            </div>
        </div>

        <?php echo $this->Partial('/index/photo-uploader.phtml', 'listing', array('listing' => $this->listing));?>

        <div class="button_em">
            <button><?php echo $this->t('Post Your Ad')?></button>
        </div>
        <p class="preview button">
            <button id="preview_link"><?php echo $this->t('Preview Your Ad')?></button>
        </p>
</fieldset>
</form>